package com.fdy;

import com.alibaba.fastjson.JSON;
import org.fdy.bgadmin.entity.ocr.JsonRootBean;

/**
 * <p>描述：</p>
 *
 * @author fangdy
 * @create 2023-12-28 12:53
 */
public class JsonToObject {

    public static void main(String[] args) {
        String json = "{\"TextDetections\":[{\"DetectedText\":\"<->\",\"Confidence\":100,\"Polygon\":[{\"X\":2098,\"Y\":244},{\"X\":2757,\"Y\":265},{\"X\":2746,\"Y\":619},{\"X\":2087,\"Y\":598}],\"AdvancedInfo\":\"{\\\"Parag\\\":{\\\"ParagNo\\\":2}}\",\"ItemPolygon\":{\"X\":2098,\"Y\":244,\"Width\":659,\"Height\":354},\"Words\":[],\"WordCoordPoint\":[]},{\"DetectedText\":\"OCR文字识别的应用\",\"Confidence\":100,\"Polygon\":[{\"X\":467,\"Y\":665},{\"X\":1655,\"Y\":665},{\"X\":1655,\"Y\":798},{\"X\":467,\"Y\":798}],\"AdvancedInfo\":\"{\\\"Parag\\\":{\\\"ParagNo\\\":1}}\",\"ItemPolygon\":{\"X\":467,\"Y\":665,\"Width\":1188,\"Height\":133},\"Words\":[],\"WordCoordPoint\":[]},{\"DetectedText\":\"OCR\",\"Confidence\":100,\"Polygon\":[{\"X\":2093,\"Y\":750},{\"X\":2751,\"Y\":750},{\"X\":2751,\"Y\":1015},{\"X\":2093,\"Y\":1015}],\"AdvancedInfo\":\"{\\\"Parag\\\":{\\\"ParagNo\\\":3}}\",\"ItemPolygon\":{\"X\":2093,\"Y\":750,\"Width\":658,\"Height\":265},\"Words\":[],\"WordCoordPoint\":[]},{\"DetectedText\":\"及背后技术原理\",\"Confidence\":100,\"Polygon\":[{\"X\":463,\"Y\":894},{\"X\":1375,\"Y\":894},{\"X\":1375,\"Y\":1026},{\"X\":463,\"Y\":1026}],\"AdvancedInfo\":\"{\\\"Parag\\\":{\\\"ParagNo\\\":1}}\",\"ItemPolygon\":{\"X\":463,\"Y\":894,\"Width\":912,\"Height\":132},\"Words\":[],\"WordCoordPoint\":[]}],\"Language\":\"zh\",\"Angel\":359.99,\"PdfPageSize\":0,\"Angle\":359.99,\"RequestId\":\"35a25be4-dcb7-4a11-b8a8-5501fc2cb468\"}\n";
        JsonRootBean jsonRootBean = JSON.parseObject(json, JsonRootBean.class);

        String toJSONString = JSON.toJSONString(jsonRootBean);
        System.out.println(toJSONString);
    }
}
